<?php

use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;

class CreateUserFreezeLogTable extends Migration
{
    /**
     * 用户行为操作：冻结
     */
    public function up(): void
    {
        Schema::create('user_freeze_log', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedInteger('user_id')->default(0)->comment('用户ID');
            $table->tinyInteger('act')->default(1)->comment('1-冻结，0-解冻');
            $table->unsignedTinyInteger('reason_type')->default(1)->comment('冻结类型');
            $table->string('reason', 100)->default(1)->comment('理由');
            $table->unsignedTinyInteger('op_admin_id')->default(0)->comment('操作账号ID');
            $table->timestamps();
            $table->tinyInteger('flag')->default(1)->comment('记录状态');
            $table->index('user_id', 'user_id');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('user_freeze_log');
    }
}
